package com.atguigu.guli.service.edu.controller.admin;


import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.edu.entity.Subject;
import com.atguigu.guli.service.edu.service.SubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author atguigu
 * @since 2021-10-26
 */
@RestController

@RequestMapping("admin/edu/subject")
public class AdminSubjectController {
    @Autowired
    SubjectService subjectService;
        //文件上传
    @PostMapping("/import")
    public R importSubjectExcel(MultipartFile file){
        subjectService.importSubjectExcel(file);
        return R.ok();
    }

    @GetMapping("/findList")
    public R getParent(){
       List<Subject> subjectList =  subjectService.getParent();
       return R.ok().data("parent",subjectList);
    }
}

